package com.example.teach.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.teach.entity.Academy;
import io.swagger.v3.oas.annotations.Webhook;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AcademyMapper extends BaseMapper<Academy> {
    @Insert("insert into academy_major (academy_id,major_id) values (#{academyId},#{majorId})")
    void create(Integer academyId, Integer majorId);

    @Select("select * from academy_major where academy_id=#{academyId} and major_id=#{majorId}")
    Academy select(Integer academyId, Integer majorId);

    @Select("select major_id from academy_major where academy_id=#{id};")
    List<Integer> selectmajor(Integer id);

    @Delete("delete from academy_major where academy_id=#{academyId} and major_id=#{majorId}")
    void deletemajor(Integer academyId, Integer majorId);

    @Select(("select major_id from academy_major where academy_id=#{id}"))
    Integer selectOneByacademyId(Integer id);
}
